package com.ruoyi.system.enums;


import lombok.Getter;

/*
 * @Author Lin
 * @Description 城市和行政区代码对应
 * @Date 2025/7/24
 */
@Getter
public enum CityCodeEnum {
    A("320100", "南京市"),
    B("320200", "无锡市"),
    C("320300", "徐州市"),
    D("320400", "常州市"),
    E("320500", "苏州市"),
    F("320600", "南通市"),
    G("320700", "连云港市"),
    H("320800", "淮安市"),
    J("320900", "盐城市"),
    K("321000", "扬州市"),
    L("321100", "镇江市"),
    M("321200", "泰州市"),
    N("321300", "宿迁市");

    private String code;
    private String name;

    CityCodeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }


    /**
     * 传入name 得到code
     */
    public static String getCodeByName(String name) {
        for (CityCodeEnum value : CityCodeEnum.values()) {
            if (value.name.equals(name)) {
                return value.code;
            }
        }
        return null;
    }
}
